<?php

namespace App\Http\Controllers\Wechat;

use Laravel\Lumen\Routing\Controller as BaseController;

class MessageController extends BaseController
{
    public static function handle( $message )
    {
        \App\Library\Log::addWechatMessage( $message );  // 添加微信用户交互日志

        switch ( $message->MsgType ) {
            case 'event':
                return MessageEventController::handle( $message );
                break;
            case 'image':
                return MessageImageController::handle( $message );
                break;
            case 'link':
                return MessageLinkController::handle( $message );
                break;
            case 'location':
                return MessageLocationController::handle( $message );
                break;
            case 'shortvideo':
                return MessageShortvideoController::handle( $message );
                break;
            case 'text':
                return MessageTextController::handle( $message );
                break;
            case 'video':
                return MessageVideoController::handle( $message );
                break;
            case 'voice':
                return MessageVoiceController::handle( $message );
                break;
            default:
                return MessageDefaultController::handle( $message );
                break;
        }
    }

}
